<template>
  <el-dialog
    title="关联角色"
    :visible.sync="dialogShow"
  >
    <el-checkbox-group v-model="checkList">
      <el-checkbox v-for="item in allRoleList" :key="item.id" :label="item.id">{{ item.name }}</el-checkbox>
    </el-checkbox-group>
  </el-dialog>

</template>

<script>
import { getRoleList } from '@/api/setting'
// import { setUserRoleApi } from '@/api/employees'
import { userInfoById } from '@/api/user'

export default {
  name: 'SetRole',
  data() {
    return {
      dialogShow: false,
      allRoleList: [],
      checkList: []
    }
  },
  methods: {
    async getAllRoleList() {
      const res = await getRoleList({
        page: 1,
        pagesize: 10000
      })
      this.allRoleList = res.rows
    },
    async getUserRoleInfo(id) {
      const res = await userInfoById(id)
      this.checkList = res.roleIds || []
    }
  }
}
</script>

<style>

</style>
